<template>
  <div>
    <div class="user_t">
      <div class="ts">
        <i v-if="head_img == ''"><img src="./../../assets/img/defoutAtho.png" width="100%"></i>
        <i v-if="head_img != ''"><img :src="head_img" width="100%"></i>
        <span>{{nick}}</span>
        <!--<span style="color: #a64200">可用积分：{{point}}</span>-->
        <!--<span style="color: #a64200">锁定积分：223.00</span>-->
      </div>
      <!--<div class="money_num">-->
      <!--<span>构树链总资产：{{alltotal | nubFixed}}</span>-->
      <!--<span>构树链可用资产：{{usetotal | nubFixed}}</span>-->
      <!--</div>-->
    </div>
    <van-row class="user-links">
      <router-link to="/record?status=0">
        <van-col span="4"><van-icon name="pending-payment" />待付款</van-col>
      </router-link>
      <router-link to="/record?status=1">
        <van-col span="5"><van-icon name="logistics" />待发货</van-col>
      </router-link>
      <router-link to="/record?status=2">
        <van-col span="5"><van-icon name="pending-deliver" />待收货</van-col>
      </router-link>
      <router-link to="/record?status=3">
        <van-col span="5"><van-icon name="pending-orders" />已完成</van-col>
      </router-link>
      <router-link to="/record?status=7">
        <van-col span="5"><van-icon name="pending-evaluate" />退款/售后</van-col>
      </router-link>
    </van-row>

    <van-cell-group class="user-group">
      <van-cell to="/record?status=a" icon="records" title="全部订单" is-link />
    </van-cell-group>

    <div class="user_bag">
      <h2>我的操作</h2>
      <ul class="u_b">
        <!--<router-link to="/myInformation" tag="li"><i class="fa fa-user-o fa-lg" aria-hidden="true"></i><span>积分记录</span></router-link>-->
        <router-link to="/myInformation" tag="li"><i class="fa fa-credit-card fa-lg" aria-hidden="true"></i><span>资料修改</span></router-link>
        <router-link v-if="user_type != 0" to="/share" tag="li"><i class="fa fa-share-alt fa-lg" aria-hidden="true"></i><span>分享</span></router-link>
        <router-link to="/setting" tag="li"><i class="fa fa-cog fa-lg" aria-hidden="true"></i><span>设置</span></router-link>
      </ul>
    </div>

    <!--<van-cell-group>-->
      <!--<van-cell icon="exchange" title="积分记录" is-link />-->
      <!--&lt;!&ndash;<van-cell icon="gold-coin" title="我的优惠券" is-link />&ndash;&gt;-->
      <!--<van-cell to="/addressList" icon="location" title="收货地址" is-link />-->
      <!--<van-cell icon="contact" title="我的合伙人" is-link />-->
      <!--<van-cell icon="info-o" title="帮助中心" is-link />-->
      <!--<van-cell to="/about" icon="more-o" title="关于我们" is-link />-->
      <!--<van-cell to="/share" icon="gift" title="分享链接" is-link />-->
      <!--<van-cell v-if="user_type == 2" icon="edit-data" title="店铺入口" is-link />-->
    <!--</van-cell-group>-->
    <!--<van-cell-group style="margin-top: .1rem;">-->
      <!--<van-cell icon="stop" title="退出登录" is-link @click="logout()"/>-->
    <!--</van-cell-group>-->
    <tabbar :num ="num"></tabbar>
  </div>
</template>

<script>
  import { Row, Col, Icon, Cell, CellGroup, Dialog } from 'vant';
  import tabbar from "./../../components/tabbar.vue"
  export default {
    components: {
      tabbar,
      [Row.name]: Row,
      [Col.name]: Col,
      [Icon.name]: Icon,
      [Cell.name]: Cell,
      [CellGroup.name]: CellGroup,
      Dialog
    },
    data(){
      return {
        num: 3,
        head_img: '',   //头像
        nick: window.localStorage.getItem('nick'),
        userid: window.localStorage.getItem('user_id'),
        point: 0,  //购物积分
        f_point: 0,  //金券积分
        user_type: '',
      }
    },
    mounted(){
      this.initialize() //拉取信息
    },
    methods:{
      initialize(){
        let _this = this;
        this.Tools.AXIOS({
          url: 'user/index',
          success: function (res) {
            let result = res.data.data
            _this.point = parseFloat(result.point);
            _this.head_img = result.head_img;
            _this.user_type = result.user_type;
            _this.f_point = parseFloat(result.f_point);
            window.localStorage.setItem('nick',result.nick_name);
          }
        })
      },
      //退出登录
      logout(){
        Dialog.confirm({
          title: '温馨提示',
          message: '确定退出登录？'
        }).then(() => {
          this.Tools.removeLocalStorageData();
          this.$router.push('/login')
        });
      }
    }
  };
</script>

<style lang="less" scoped>
  .user_t{
    width: 100%;
    padding: .6rem 0;
    display: flex;
    justify-content: space-between;
    background-image: url("./../../assets/img/home.png");
    background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    -webkit-background-size: 100% 100%;
  }
  .user_t .ts{
    width: 100%;
    display: -ms-flexbox;
    display: flex;
    margin-top: .2rem;
    flex-direction: column;
  }
  .user_t .ts i {
    width: 1.3rem;
    height: 1.3rem;
    margin: auto;
    background: #fff;
    border-radius: 100px;
    display: block;
    overflow: hidden;
  }
  .user_t .ts span{ font-size: .4rem; line-height: .65rem; color: #666;text-align: center;}

  .user {
    &-poster {
      width: 100%;
      height: 4rem;
      display: block;
    }
    &-group {
      margin-bottom: .3rem;
    }
    &-links {
      padding: 15px 0;
      font-size: 12px;
      text-align: center;
      background-color: #fff;
      .van-icon {
        display: block;
        font-size: 24px;
      }
      div {
        color: #9c7abb;
      }
    }
  }

  .user_bag{ width: 100%;}
  .user_bag h2{ width: 100%; font-size: .38rem; color: #404040; background: #fff; text-indent: .2rem; font-weight: normal; border-bottom: 1px solid #F6F6F6; padding: .3rem 0;}
  .user_bag ul{ width: 100%; overflow: hidden; border-bottom: 8px solid #F6F6F6;}
  .user_bag ul li{ width: 25%; text-align: center; background: #fff; line-height: 1.5rem; position: relative; padding: .5rem 0 .3rem; float: left; border-bottom: 1px solid #F4F4F4; border-right: 1px solid #F4F4F4; box-sizing: border-box;}
  .user_bag ul li:nth-of-type(4n){ border-right: 0;}
  .user_bag ul li i{ color: #FD9709; display: block;}
  .user_bag ul li span{ font-size: .35rem; color: #404040;}
  .user_bag ul li b{ font-weight: normal; font-size: .32rem; color: #FD9709; width: 100%; position: absolute; left: 0; bottom: -.2rem; text-align: center;}
</style>
